package jnpf.message;

import jnpf.base.UserInfo;
import jnpf.message.entity.SendMessageConfigEntity;
import jnpf.message.fallback.SentMessageApiFallback;
import jnpf.message.model.SentMessageForm;
import jnpf.utils.FeignName;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 调用系统消息Api
 *
 * @author JNPF开发平台组
 * @version V3.1.0
 * @copyright 引迈信息技术有限公司（https://www.jnpfsoft.com）
 * @date 2021-03-24
 */
@FeignClient(name = FeignName.MESSAGE_SERVER_NAME, fallback = SentMessageApiFallback.class,path = "/MessageAll")
public interface SentMessageApi {

    /**
     * 发送消息
     *
     * @param sentMessageForm
     * @return
     */
    @PostMapping
    void sendMessage(@RequestBody SentMessageForm sentMessageForm);

    /**
     * 发送消息
     *
     * @param sentMessageForm
     * @return
     */
    @PostMapping("/sendDelegateMsg")
    void sendDelegateMsg(@RequestBody SentMessageForm sentMessageForm);

    /**
     * 发送消息
     *
     * @param toUserIds 发送用户
     * @param title     标题
     * @param bodyText  内容
     */
    @PostMapping("/sentMessage")
    void sentMessage(@RequestParam("toUserIds") List<String> toUserIds, @RequestParam("title") String title , @RequestParam("bodyText") String bodyText, @RequestParam("source") Integer source, @RequestParam("type") Integer type , @RequestBody UserInfo userInfo);

    @GetMapping("/logoutWS")
    void logoutWebsocketByToken(@RequestParam(name = "token", required = false) String token, @RequestParam(name = "userId", required = false) String userId);

    @PostMapping("/sendScheduleMessage/{type}")
    void sendScheduleMessage(@RequestBody SentMessageForm sentMessageForm,@PathVariable("type") String type);

}
